(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
empty(nil) → true
empty(cons(x, y)) → false
tail(nil) → nil
tail(cons(x, y)) → y
head(cons(x, y)) → x
zero(0) → true
zero(s(x)) → false
p(0) → 0
p(s(0)) → 0
p(s(s(x))) → s(p(s(x)))
intlist(x) → if_intlist(empty(x), x)
if_intlist(true, x) → nil
if_intlist(false, x) → cons(s(head(x)), intlist(tail(x)))
int(x, y) → if_int(zero(x), zero(y), x, y)
if_int(true, b, x, y) → if1(b, x, y)
if_int(false, b, x, y) → if2(b, x, y)
if1(true, x, y) → cons(0, nil)
if1(false, x, y) → cons(0, int(s(0), y))
if2(true, x, y) → nil
if2(false, x, y) → intlist(int(p(x), p(y)))
Rewrite Strategy: INNERMOST
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
empty(nil) → true
empty(cons(x, y)) → false
tail(nil) → nil
tail(cons(x, y)) → y
head(cons(x, y)) → x
zero(0') → true
zero(s(x)) → false
p(0') → 0'
p(s(0')) → 0'
p(s(s(x))) → s(p(s(x)))
intlist(x) → if_intlist(empty(x), x)
if_intlist(true, x) → nil
if_intlist(false, x) → cons(s(head(x)), intlist(tail(x)))
int(x, y) → if_int(zero(x), zero(y), x, y)
if_int(true, b, x, y) → if1(b, x, y)
if_int(false, b, x, y) → if2(b, x, y)
if1(true, x, y) → cons(0', nil)
if1(false, x, y) → cons(0', int(s(0'), y))
if2(true, x, y) → nil
if2(false, x, y) → intlist(int(p(x), p(y)))
S is empty.
Rewrite Strategy: INNERMOST
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
Innermost TRS:
Rules:
empty(nil) → true
empty(cons(x, y)) → false
tail(nil) → nil
tail(cons(x, y)) → y
head(cons(x, y)) → x
zero(0') → true
zero(s(x)) → false
p(0') → 0'
p(s(0')) → 0'
p(s(s(x))) → s(p(s(x)))
intlist(x) → if_intlist(empty(x), x)
if_intlist(true, x) → nil
if_intlist(false, x) → cons(s(head(x)), intlist(tail(x)))
int(x, y) → if_int(zero(x), zero(y), x, y)
if_int(true, b, x, y) → if1(b, x, y)
if_int(false, b, x, y) → if2(b, x, y)
if1(true, x, y) → cons(0', nil)
if1(false, x, y) → cons(0', int(s(0'), y))
if2(true, x, y) → nil
if2(false, x, y) → intlist(int(p(x), p(y)))
Types:
empty :: nil:cons → true:false
nil :: nil:cons
true :: true:false
cons :: 0':s → nil:cons → nil:cons
false :: true:false
tail :: nil:cons → nil:cons
head :: nil:cons → 0':s
zero :: 0':s → true:false
0' :: 0':s
s :: 0':s → 0':s
p :: 0':s → 0':s
intlist :: nil:cons → nil:cons
if_intlist :: true:false → nil:cons → nil:cons
int :: 0':s → 0':s → nil:cons
if_int :: true:false → true:false → 0':s → 0':s → nil:cons
if1 :: true:false → 0':s → 0':s → nil:cons
if2 :: true:false → 0':s → 0':s → nil:cons
hole_true:false1_0 :: true:false
hole_nil:cons2_0 :: nil:cons
hole_0':s3_0 :: 0':s
gen_nil:cons4_0 :: Nat → nil:cons
gen_0':s5_0 :: Nat → 0':s
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
p,
intlist,
intThey will be analysed ascendingly in the following order:
p < int
intlist < int
(6) Obligation:
Innermost TRS:
Rules:
empty(
nil) →
trueempty(
cons(
x,
y)) →
falsetail(
nil) →
niltail(
cons(
x,
y)) →
yhead(
cons(
x,
y)) →
xzero(
0') →
truezero(
s(
x)) →
falsep(
0') →
0'p(
s(
0')) →
0'p(
s(
s(
x))) →
s(
p(
s(
x)))
intlist(
x) →
if_intlist(
empty(
x),
x)
if_intlist(
true,
x) →
nilif_intlist(
false,
x) →
cons(
s(
head(
x)),
intlist(
tail(
x)))
int(
x,
y) →
if_int(
zero(
x),
zero(
y),
x,
y)
if_int(
true,
b,
x,
y) →
if1(
b,
x,
y)
if_int(
false,
b,
x,
y) →
if2(
b,
x,
y)
if1(
true,
x,
y) →
cons(
0',
nil)
if1(
false,
x,
y) →
cons(
0',
int(
s(
0'),
y))
if2(
true,
x,
y) →
nilif2(
false,
x,
y) →
intlist(
int(
p(
x),
p(
y)))
Types:
empty :: nil:cons → true:false
nil :: nil:cons
true :: true:false
cons :: 0':s → nil:cons → nil:cons
false :: true:false
tail :: nil:cons → nil:cons
head :: nil:cons → 0':s
zero :: 0':s → true:false
0' :: 0':s
s :: 0':s → 0':s
p :: 0':s → 0':s
intlist :: nil:cons → nil:cons
if_intlist :: true:false → nil:cons → nil:cons
int :: 0':s → 0':s → nil:cons
if_int :: true:false → true:false → 0':s → 0':s → nil:cons
if1 :: true:false → 0':s → 0':s → nil:cons
if2 :: true:false → 0':s → 0':s → nil:cons
hole_true:false1_0 :: true:false
hole_nil:cons2_0 :: nil:cons
hole_0':s3_0 :: 0':s
gen_nil:cons4_0 :: Nat → nil:cons
gen_0':s5_0 :: Nat → 0':s
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
The following defined symbols remain to be analysed:
p, intlist, int
They will be analysed ascendingly in the following order:
p < int
intlist < int
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
p(
gen_0':s5_0(
+(
1,
n7_0))) →
gen_0':s5_0(
n7_0), rt ∈ Ω(1 + n7
0)
Induction Base:
p(gen_0':s5_0(+(1, 0))) →RΩ(1)
0'
Induction Step:
p(gen_0':s5_0(+(1, +(n7_0, 1)))) →RΩ(1)
s(p(s(gen_0':s5_0(n7_0)))) →IH
s(gen_0':s5_0(c8_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
Innermost TRS:
Rules:
empty(
nil) →
trueempty(
cons(
x,
y)) →
falsetail(
nil) →
niltail(
cons(
x,
y)) →
yhead(
cons(
x,
y)) →
xzero(
0') →
truezero(
s(
x)) →
falsep(
0') →
0'p(
s(
0')) →
0'p(
s(
s(
x))) →
s(
p(
s(
x)))
intlist(
x) →
if_intlist(
empty(
x),
x)
if_intlist(
true,
x) →
nilif_intlist(
false,
x) →
cons(
s(
head(
x)),
intlist(
tail(
x)))
int(
x,
y) →
if_int(
zero(
x),
zero(
y),
x,
y)
if_int(
true,
b,
x,
y) →
if1(
b,
x,
y)
if_int(
false,
b,
x,
y) →
if2(
b,
x,
y)
if1(
true,
x,
y) →
cons(
0',
nil)
if1(
false,
x,
y) →
cons(
0',
int(
s(
0'),
y))
if2(
true,
x,
y) →
nilif2(
false,
x,
y) →
intlist(
int(
p(
x),
p(
y)))
Types:
empty :: nil:cons → true:false
nil :: nil:cons
true :: true:false
cons :: 0':s → nil:cons → nil:cons
false :: true:false
tail :: nil:cons → nil:cons
head :: nil:cons → 0':s
zero :: 0':s → true:false
0' :: 0':s
s :: 0':s → 0':s
p :: 0':s → 0':s
intlist :: nil:cons → nil:cons
if_intlist :: true:false → nil:cons → nil:cons
int :: 0':s → 0':s → nil:cons
if_int :: true:false → true:false → 0':s → 0':s → nil:cons
if1 :: true:false → 0':s → 0':s → nil:cons
if2 :: true:false → 0':s → 0':s → nil:cons
hole_true:false1_0 :: true:false
hole_nil:cons2_0 :: nil:cons
hole_0':s3_0 :: 0':s
gen_nil:cons4_0 :: Nat → nil:cons
gen_0':s5_0 :: Nat → 0':s
Lemmas:
p(gen_0':s5_0(+(1, n7_0))) → gen_0':s5_0(n7_0), rt ∈ Ω(1 + n70)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
The following defined symbols remain to be analysed:
intlist, int
They will be analysed ascendingly in the following order:
intlist < int
(10) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol intlist.
(11) Obligation:
Innermost TRS:
Rules:
empty(
nil) →
trueempty(
cons(
x,
y)) →
falsetail(
nil) →
niltail(
cons(
x,
y)) →
yhead(
cons(
x,
y)) →
xzero(
0') →
truezero(
s(
x)) →
falsep(
0') →
0'p(
s(
0')) →
0'p(
s(
s(
x))) →
s(
p(
s(
x)))
intlist(
x) →
if_intlist(
empty(
x),
x)
if_intlist(
true,
x) →
nilif_intlist(
false,
x) →
cons(
s(
head(
x)),
intlist(
tail(
x)))
int(
x,
y) →
if_int(
zero(
x),
zero(
y),
x,
y)
if_int(
true,
b,
x,
y) →
if1(
b,
x,
y)
if_int(
false,
b,
x,
y) →
if2(
b,
x,
y)
if1(
true,
x,
y) →
cons(
0',
nil)
if1(
false,
x,
y) →
cons(
0',
int(
s(
0'),
y))
if2(
true,
x,
y) →
nilif2(
false,
x,
y) →
intlist(
int(
p(
x),
p(
y)))
Types:
empty :: nil:cons → true:false
nil :: nil:cons
true :: true:false
cons :: 0':s → nil:cons → nil:cons
false :: true:false
tail :: nil:cons → nil:cons
head :: nil:cons → 0':s
zero :: 0':s → true:false
0' :: 0':s
s :: 0':s → 0':s
p :: 0':s → 0':s
intlist :: nil:cons → nil:cons
if_intlist :: true:false → nil:cons → nil:cons
int :: 0':s → 0':s → nil:cons
if_int :: true:false → true:false → 0':s → 0':s → nil:cons
if1 :: true:false → 0':s → 0':s → nil:cons
if2 :: true:false → 0':s → 0':s → nil:cons
hole_true:false1_0 :: true:false
hole_nil:cons2_0 :: nil:cons
hole_0':s3_0 :: 0':s
gen_nil:cons4_0 :: Nat → nil:cons
gen_0':s5_0 :: Nat → 0':s
Lemmas:
p(gen_0':s5_0(+(1, n7_0))) → gen_0':s5_0(n7_0), rt ∈ Ω(1 + n70)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
The following defined symbols remain to be analysed:
int
(12) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
int(
gen_0':s5_0(
+(
1,
n37645_0)),
gen_0':s5_0(
n37645_0)) →
gen_nil:cons4_0(
0), rt ∈ Ω(1 + n37645
0 + n37645
02)
Induction Base:
int(gen_0':s5_0(+(1, 0)), gen_0':s5_0(0)) →RΩ(1)
if_int(zero(gen_0':s5_0(+(1, 0))), zero(gen_0':s5_0(0)), gen_0':s5_0(+(1, 0)), gen_0':s5_0(0)) →RΩ(1)
if_int(false, zero(gen_0':s5_0(0)), gen_0':s5_0(1), gen_0':s5_0(0)) →RΩ(1)
if_int(false, true, gen_0':s5_0(1), gen_0':s5_0(0)) →RΩ(1)
if2(true, gen_0':s5_0(1), gen_0':s5_0(0)) →RΩ(1)
nil
Induction Step:
int(gen_0':s5_0(+(1, +(n37645_0, 1))), gen_0':s5_0(+(n37645_0, 1))) →RΩ(1)
if_int(zero(gen_0':s5_0(+(1, +(n37645_0, 1)))), zero(gen_0':s5_0(+(n37645_0, 1))), gen_0':s5_0(+(1, +(n37645_0, 1))), gen_0':s5_0(+(n37645_0, 1))) →RΩ(1)
if_int(false, zero(gen_0':s5_0(+(1, n37645_0))), gen_0':s5_0(+(2, n37645_0)), gen_0':s5_0(+(1, n37645_0))) →RΩ(1)
if_int(false, false, gen_0':s5_0(+(2, n37645_0)), gen_0':s5_0(+(1, n37645_0))) →RΩ(1)
if2(false, gen_0':s5_0(+(2, n37645_0)), gen_0':s5_0(+(1, n37645_0))) →RΩ(1)
intlist(int(p(gen_0':s5_0(+(2, n37645_0))), p(gen_0':s5_0(+(1, n37645_0))))) →LΩ(2 + n376450)
intlist(int(gen_0':s5_0(+(1, n37645_0)), p(gen_0':s5_0(+(1, n37645_0))))) →LΩ(1 + n376450)
intlist(int(gen_0':s5_0(+(1, n37645_0)), gen_0':s5_0(n37645_0))) →IH
intlist(gen_nil:cons4_0(0)) →RΩ(1)
if_intlist(empty(gen_nil:cons4_0(0)), gen_nil:cons4_0(0)) →RΩ(1)
if_intlist(true, gen_nil:cons4_0(0)) →RΩ(1)
nil
We have rt ∈ Ω(n2) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n2).
(13) Complex Obligation (BEST)
(14) Obligation:
Innermost TRS:
Rules:
empty(
nil) →
trueempty(
cons(
x,
y)) →
falsetail(
nil) →
niltail(
cons(
x,
y)) →
yhead(
cons(
x,
y)) →
xzero(
0') →
truezero(
s(
x)) →
falsep(
0') →
0'p(
s(
0')) →
0'p(
s(
s(
x))) →
s(
p(
s(
x)))
intlist(
x) →
if_intlist(
empty(
x),
x)
if_intlist(
true,
x) →
nilif_intlist(
false,
x) →
cons(
s(
head(
x)),
intlist(
tail(
x)))
int(
x,
y) →
if_int(
zero(
x),
zero(
y),
x,
y)
if_int(
true,
b,
x,
y) →
if1(
b,
x,
y)
if_int(
false,
b,
x,
y) →
if2(
b,
x,
y)
if1(
true,
x,
y) →
cons(
0',
nil)
if1(
false,
x,
y) →
cons(
0',
int(
s(
0'),
y))
if2(
true,
x,
y) →
nilif2(
false,
x,
y) →
intlist(
int(
p(
x),
p(
y)))
Types:
empty :: nil:cons → true:false
nil :: nil:cons
true :: true:false
cons :: 0':s → nil:cons → nil:cons
false :: true:false
tail :: nil:cons → nil:cons
head :: nil:cons → 0':s
zero :: 0':s → true:false
0' :: 0':s
s :: 0':s → 0':s
p :: 0':s → 0':s
intlist :: nil:cons → nil:cons
if_intlist :: true:false → nil:cons → nil:cons
int :: 0':s → 0':s → nil:cons
if_int :: true:false → true:false → 0':s → 0':s → nil:cons
if1 :: true:false → 0':s → 0':s → nil:cons
if2 :: true:false → 0':s → 0':s → nil:cons
hole_true:false1_0 :: true:false
hole_nil:cons2_0 :: nil:cons
hole_0':s3_0 :: 0':s
gen_nil:cons4_0 :: Nat → nil:cons
gen_0':s5_0 :: Nat → 0':s
Lemmas:
p(gen_0':s5_0(+(1, n7_0))) → gen_0':s5_0(n7_0), rt ∈ Ω(1 + n70)
int(gen_0':s5_0(+(1, n37645_0)), gen_0':s5_0(n37645_0)) → gen_nil:cons4_0(0), rt ∈ Ω(1 + n376450 + n3764502)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n2) was proven with the following lemma:
int(gen_0':s5_0(+(1, n37645_0)), gen_0':s5_0(n37645_0)) → gen_nil:cons4_0(0), rt ∈ Ω(1 + n376450 + n3764502)
(16) BOUNDS(n^2, INF)
(17) Obligation:
Innermost TRS:
Rules:
empty(
nil) →
trueempty(
cons(
x,
y)) →
falsetail(
nil) →
niltail(
cons(
x,
y)) →
yhead(
cons(
x,
y)) →
xzero(
0') →
truezero(
s(
x)) →
falsep(
0') →
0'p(
s(
0')) →
0'p(
s(
s(
x))) →
s(
p(
s(
x)))
intlist(
x) →
if_intlist(
empty(
x),
x)
if_intlist(
true,
x) →
nilif_intlist(
false,
x) →
cons(
s(
head(
x)),
intlist(
tail(
x)))
int(
x,
y) →
if_int(
zero(
x),
zero(
y),
x,
y)
if_int(
true,
b,
x,
y) →
if1(
b,
x,
y)
if_int(
false,
b,
x,
y) →
if2(
b,
x,
y)
if1(
true,
x,
y) →
cons(
0',
nil)
if1(
false,
x,
y) →
cons(
0',
int(
s(
0'),
y))
if2(
true,
x,
y) →
nilif2(
false,
x,
y) →
intlist(
int(
p(
x),
p(
y)))
Types:
empty :: nil:cons → true:false
nil :: nil:cons
true :: true:false
cons :: 0':s → nil:cons → nil:cons
false :: true:false
tail :: nil:cons → nil:cons
head :: nil:cons → 0':s
zero :: 0':s → true:false
0' :: 0':s
s :: 0':s → 0':s
p :: 0':s → 0':s
intlist :: nil:cons → nil:cons
if_intlist :: true:false → nil:cons → nil:cons
int :: 0':s → 0':s → nil:cons
if_int :: true:false → true:false → 0':s → 0':s → nil:cons
if1 :: true:false → 0':s → 0':s → nil:cons
if2 :: true:false → 0':s → 0':s → nil:cons
hole_true:false1_0 :: true:false
hole_nil:cons2_0 :: nil:cons
hole_0':s3_0 :: 0':s
gen_nil:cons4_0 :: Nat → nil:cons
gen_0':s5_0 :: Nat → 0':s
Lemmas:
p(gen_0':s5_0(+(1, n7_0))) → gen_0':s5_0(n7_0), rt ∈ Ω(1 + n70)
int(gen_0':s5_0(+(1, n37645_0)), gen_0':s5_0(n37645_0)) → gen_nil:cons4_0(0), rt ∈ Ω(1 + n376450 + n3764502)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
No more defined symbols left to analyse.
(18) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n2) was proven with the following lemma:
int(gen_0':s5_0(+(1, n37645_0)), gen_0':s5_0(n37645_0)) → gen_nil:cons4_0(0), rt ∈ Ω(1 + n376450 + n3764502)
(19) BOUNDS(n^2, INF)
(20) Obligation:
Innermost TRS:
Rules:
empty(
nil) →
trueempty(
cons(
x,
y)) →
falsetail(
nil) →
niltail(
cons(
x,
y)) →
yhead(
cons(
x,
y)) →
xzero(
0') →
truezero(
s(
x)) →
falsep(
0') →
0'p(
s(
0')) →
0'p(
s(
s(
x))) →
s(
p(
s(
x)))
intlist(
x) →
if_intlist(
empty(
x),
x)
if_intlist(
true,
x) →
nilif_intlist(
false,
x) →
cons(
s(
head(
x)),
intlist(
tail(
x)))
int(
x,
y) →
if_int(
zero(
x),
zero(
y),
x,
y)
if_int(
true,
b,
x,
y) →
if1(
b,
x,
y)
if_int(
false,
b,
x,
y) →
if2(
b,
x,
y)
if1(
true,
x,
y) →
cons(
0',
nil)
if1(
false,
x,
y) →
cons(
0',
int(
s(
0'),
y))
if2(
true,
x,
y) →
nilif2(
false,
x,
y) →
intlist(
int(
p(
x),
p(
y)))
Types:
empty :: nil:cons → true:false
nil :: nil:cons
true :: true:false
cons :: 0':s → nil:cons → nil:cons
false :: true:false
tail :: nil:cons → nil:cons
head :: nil:cons → 0':s
zero :: 0':s → true:false
0' :: 0':s
s :: 0':s → 0':s
p :: 0':s → 0':s
intlist :: nil:cons → nil:cons
if_intlist :: true:false → nil:cons → nil:cons
int :: 0':s → 0':s → nil:cons
if_int :: true:false → true:false → 0':s → 0':s → nil:cons
if1 :: true:false → 0':s → 0':s → nil:cons
if2 :: true:false → 0':s → 0':s → nil:cons
hole_true:false1_0 :: true:false
hole_nil:cons2_0 :: nil:cons
hole_0':s3_0 :: 0':s
gen_nil:cons4_0 :: Nat → nil:cons
gen_0':s5_0 :: Nat → 0':s
Lemmas:
p(gen_0':s5_0(+(1, n7_0))) → gen_0':s5_0(n7_0), rt ∈ Ω(1 + n70)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(0', gen_nil:cons4_0(x))
gen_0':s5_0(0) ⇔ 0'
gen_0':s5_0(+(x, 1)) ⇔ s(gen_0':s5_0(x))
No more defined symbols left to analyse.
(21) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
p(gen_0':s5_0(+(1, n7_0))) → gen_0':s5_0(n7_0), rt ∈ Ω(1 + n70)
(22) BOUNDS(n^1, INF)